package com.my.study.aqs;

import com.my.study.utils.ThreadUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * @author Carlos
 * @version 1.0
 * @Description TODO
 * @date 2021/6/17 8:17
 **/
@Slf4j(topic = "c.TestReadWrite")
public class TestReadWrite {

    public static void main(String[] args) {

        DataContainer dataContainer = new DataContainer();

        new Thread(() -> {
            dataContainer.read();
        }, "t1").start();

        new Thread(() -> {
            dataContainer.read();
        }, "t2").start();

        new Thread(() -> {
            ThreadUtil.sleep(1);
            dataContainer.write(1);
        }, "t3").start();
    }
}
